 

########################################################################################################
#                                       GSL part
########################################################################################################
# Defines:
# GSL_LIBRARIES
# GSL_INCLUDE_DIRS

message(STATUS " \n link with GSL libraries")

#include dir
unset (GSL_INCLUDE_DIRS CACHE)

FIND_PATH(GSL_INCLUDE_DIRS gsl/gsl_version.h
 PATHS
  $ENV{GSL_DIR}/include/gsl
  $ENV{GSL_DIR}/include/
  $ENV{GSL_INC}/
  $ENV{SOAMS_LIBRARY_PATH}/gsl/
  $ENV{SOAMS_LIBRARY_PATH}/gsl/include
  $ENV{SOAMS_LIBRARY_PATH}/gsl/include/gsl
  /usr/include/gsl/include
  /usr/include/gsl
  /usr/include/
)

if (NOT GSL_INCLUDE_DIRS)
  message (FATAL_ERROR " \n The include directory of the library gsl containing the file gsl_version.h has not been found. Directory checked:
			 from environment var. GSL_DIR: $ENV{GSL_DIR}/include/gsl
			 from environment var. GSL_DIR: $ENV{GSL_DIR}/include/
 			 from environment var. GSL_INC: $ENV{GSL_INC}/
			 from environment var. SOAMS_LIBRARY_PATH: $ENV{SOAMS_LIBRARY_PATH}/gsl/include/gsl
			 from environment var. SOAMS_LIBRARY_PATH: $ENV{SOAMS_LIBRARY_PATH}/gsl/include/
			 from environment var. SOAMS_LIBRARY_PATH: $ENV{SOAMS_LIBRARY_PATH}/gsl/
                         /usr/include/gsl/include
                         /usr/include/gsl
                         /usr/include/
if you don't have the libary on your computer, you can install it from http://www.gnu.org/software/gsl/ 
if the library is installed in another directory, you can:
			 set the environment variable GSL_DIR to the installed gsl directory (or GSL_INC to its include directory). 
			 create a gsl link (to the build gsl dir) into the directory pointed by the environment variable SOAMS_LIBRARY_PATH \n"
            )
endif (NOT GSL_INCLUDE_DIRS)

message(STATUS "GSL include path: ${GSL_INCLUDE_DIRS}")

#-------------------  gsl lib ------------------------

find_library( GSL_LIB  gsl
 PATHS
  $ENV{GSL_DIR}/lib
  $ENV{GSL_LIB}/
  $ENV{SOAMS_LIBRARY_PATH}/gsl/lib
  /usr/lib
)

if (NOT GSL_LIB)
  message (FATAL_ERROR " \n The include directory of the library gsl has not been found. Directory checked:
			 from environment var. GSL_DIR: $ENV{GSL_DIR}/lib
			 from environment var. GSL_DIR: $ENV{GSL_LIB}/include/
			 from environment var. SOAMS_LIBRARY_PATH: $ENV{SOAMS_LIBRARY_PATH}/gsl/lib
                         /usr/lib
if you don't have the libary on your computer, you can install it from http://www.gnu.org/software/gsl/ 
if the library is installed in another directory, you can:
			 set the environment variable GSL_DIR to the installed gsl directory (or GSL_LIB to its include directory). 
			 create a gsl link (to the build gsl dir) into the directory pointed by the environment variable SOAMS_LIBRARY_PATH \n"
            )
endif (NOT GSL_LIB)

#-------------------  gslcblas lib ------------------------

find_library( GSLCBLAS_LIB  gslcblas
 PATHS
  $ENV{GSL_DIR}/lib
  $ENV{GSL_LIB}/
  $ENV{SOAMS_LIBRARY_PATH}/gsl/lib
  /usr/lib
)

if (NOT GSLCBLAS_LIB)
  message (FATAL_ERROR " \n The include directory of the library gslcblas has not been found. Directory checked:
			 from environment var. GSL_DIR: $ENV{GSL_DIR}/lib
			 from environment var. GSL_DIR: $ENV{GSL_LIB}/include/
			 from environment var. SOAMS_LIBRARY_PATH: $ENV{SOAMS_LIBRARY_PATH}/gsl/lib
                         /usr/lib
if you don't have the libary on your computer, you can install it from http://www.gnu.org/software/gsl/ 
if the library is installed in another directory, you can:
			 set the environment variable GSL_DIR to the installed gsl directory (or GSL_LIB to its include directory). 
			 create a gsl link (to the build gsl dir) into the directory pointed by the environment variable SOAMS_LIBRARY_PATH \n"
            )
endif (NOT GSLCBLAS_LIB)


SET (GSL_LIBRARIES ${GSL_LIB} ${GSLCBLAS_LIB})

message(STATUS "GSL libraries path(s): ${GSL_LIBRARIES} ")


MARK_AS_ADVANCED( GSL_INCLUDE_DIRS  GSL_LIB  GSLCBLAS_LIB )


